package com.ck.ck_back.controller;

import com.ck.ck_back.pojo.Production;
import com.ck.ck_back.pojo.Result;
import com.ck.ck_back.service.likeproductionservice;
import com.ck.ck_back.service.productionservice;
import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/likeproduction")
public class LikeProductionController {
    @Resource
    private likeproductionservice likeproductionserviceimpl;

    @PostMapping("/like")
    public Object insert(int likedProductionId, String likedPostId){
        likeproductionserviceimpl.saveLiked2Redis(likedProductionId,likedPostId);
        return Result.success();
    }

    @PostMapping("/dislike")
    public Object no(int likedProductionId, String likedPostId){
        likeproductionserviceimpl.unlikeFromRedis(likedProductionId,likedPostId);
        return Result.success();
    }

    @PostMapping("/get")
    public Object getall(int likedProductionId, String likedPostId){

        return likeproductionserviceimpl.get_production_state(likedProductionId,likedPostId);
    }

}
